public class StateFormatter {
	
	public static State getState(String instate) {
		
		String newState;
    	
    	inState = inState.trim().replaceAll(' ', '').toLowerCase();
    	
    	if(inState == 'al' || inState == 'alabama' || inState.startsWith('alab')) {
			return new State('Alabama', 'AL');
		}
		if(inState == 'ak' || inState == 'alaska' || inState.startsWith('alas')) {
			return new State('Alaska', 'AK');
		}
		if(inState == 'as' || inState == 'americansamoa' || inState.startsWith('amer')) {
			return new State('American Samoa', 'AS');
		}
		if(inState == 'az' || inState == 'arizona' || inState.startsWith('ari')) {
			return new State('Arizona', 'AZ');
		}
		if(inState == 'ar' || inState == 'arkansas' || inState.startsWith('ark')) {
			return new State('Arkansas', 'AR');
		}
		if(inState == 'ca' || inState == 'california' || inState.startsWith('cal')) {
			return new State('California', 'CA');
		}
		if(inState == 'co' || inState == 'colorado' || inState.startsWith('col')) {
			return new State('Colorado', 'CO');
		}
		if(inState == 'ct' || inState == 'connecticut' || inState.startsWith('con')) {
			return new State('Connecticut', 'CT');
		}
		if(inState == 'de' || inState == 'delaware' || inState.startsWith('del')) {
			return new State('Delaware', 'DE');
		}
		if(inState == 'dc' || inState == 'districtofcolumbia' || inState.startsWith('dis')) {
			return new State('District Of Columbia', 'DC');
		}
		if(inState == 'fm' || inState == 'federatedstatesofmicronesia' || inState.startsWith('fed')) {
			return new State('Federated States Of Micronesia', 'FM');
		}
		if(inState == 'fl' || inState == 'florida' || inState.startsWith('flo')) {
			return new State('Florida', 'FL');
		}
		if(inState == 'ga' || inState == 'georgia' || inState.startsWith('geo')) {
			return new State('Georgia', 'GA');
		}
		if(inState == 'gu' || inState == 'guam' || inState.startsWith('gua')) {
			return new State('Guam', 'GU');
		}
		if(inState == 'hi' || inState == 'hawaii' || inState.startsWith('haw')) {
			return new State('Hawaii', 'HI');
		}
		if(inState == 'id' || inState == 'idaho' || inState.startsWith('ida')) {
			return new State('Idaho', 'ID');
		}
		if(inState == 'il' || inState == 'illinois' || inState.startsWith('ill')) {
			return new State('Illinois', 'IL');
		}
		if(inState == 'in' || inState == 'indiana' || inState.startsWith('ind')) {
			return new State('Indiana', 'IN');
		}
		if(inState == 'ia' || inState == 'iowa' || inState.startsWith('iow')) {
			return new State('Iowa', 'IA');
		}
		if(inState == 'ks' || inState == 'kansas' || inState.startsWith('kan')) {
			return new State('Kansas', 'KS');
		}
		if(inState == 'ky' || inState == 'kentucky' || inState.startsWith('ken')) {
			return new State('Kentucky', 'KY');
		}
		if(inState == 'la' || inState == 'louisiana' || inState.startsWith('lou')) {
			return new State('Louisiana', 'LA');
		}
		if(inState == 'me' || inState == 'maine' || inState.startsWith('mai')) {
			return new State('Maine', 'ME');
		}
		if(inState == 'mh' || inState == 'marshallislands' || inState.startsWith('mars')) {
			return new State('Marshall Islands', 'MH');
		}
		if(inState == 'md' || inState == 'maryland' || inState.startsWith('mary')) {
			return new State('Maryland', 'MD');
		}
		if(inState == 'ma' || inState == 'massachusetts' || inState.startsWith('mas')) {
			return new State('Massachusetts', 'MA');
		}
		if(inState == 'mi' || inState == 'michigan' || inState.startsWith('mic')) {
			return new State('Michigan', 'MI');
		}
		if(inState == 'mn' || inState == 'minnesota' || inState.startsWith('min')) {
			return new State('Minnesota', 'MN');
		}
		if(inState == 'ms' || inState == 'mississippi' || inState.startsWith('missi')) {
			return new State('Mississippi', 'MS');
		}
		if(inState == 'mo' || inState == 'missouri' || inState.startsWith('misso')) {
			return new State('Missouri', 'MO');
		}
		if(inState == 'mt' || inState == 'montana' || inState.startsWith('mon')) {
			return new State('Montana', 'MT');
		}
		if(inState == 'ne' || inState == 'nebraska' || inState.startsWith('neb')) {
			return new State('Nebraska', 'NE');
		}
		if(inState == 'nv' || inState == 'nevada' || inState.startsWith('nev')) {
			return new State('Nevada', 'NV');
		}
		if(inState == 'nh' || inState == 'newhampshire' || inState.startsWith('newh')) {
			return new State('New Hampshire', 'NH');
		}
		if(inState == 'nj' || inState == 'newjersey' || inState.startsWith('newj')) {
			return new State('New Jersey', 'NJ');
		}
		if(inState == 'nm' || inState == 'newmexico' || inState.startsWith('newm')) {
			return new State('New Mexico', 'NM');
		}
		if(inState == 'ny' || inState == 'newyork' || inState.startsWith('newy')) {
			return new State('New York', 'NY');
		}
		if(inState == 'nc' || inState == 'northcarolina' || inState.startsWith('northc')) {
			return new State('North Carolina', 'NC');
		}
		if(inState == 'nd' || inState == 'northdakota' || inState.startsWith('northd')) {
			return new State('North Dakota', 'ND');
		}
		if(inState == 'mp' || inState == 'northernmarianaislands' || inState.startsWith('northernmar')) {
			return new State('Northern Mariana Islands', 'MP');
		}
		if(inState == 'oh' || inState == 'ohio' || inState.startsWith('ohi')) {
			return new State('Ohio', 'OH');
		}
		if(inState == 'ok' || inState == 'oklahoma' || inState.startsWith('okl')) {
			return new State('Oklahoma', 'OK');
		}
		if(inState == 'or' || inState == 'oregon' || inState.startsWith('ore')) {
			return new State('Oregon', 'OR');
		}
		if(inState == 'pw' || inState == 'palau' || inState.startsWith('pala')) {
			return new State('Palau', 'PW');
		}
		if(inState == 'pa' || inState == 'pennsylvania' || inState.startsWith('pen')) {
			return new State('Pennsylvania', 'PA');
		}
		if(inState == 'pr' || inState == 'puertorico' || inState.startsWith('pue')) {
			return new State('Puerto Rico', 'PR');
		}
		if(inState == 'ri' || inState == 'rhodeisland' || inState.startsWith('rho')) {
			return new State('Rhode Island', 'RI');
		}
		if(inState == 'sc' || inState == 'southcarolina' || inState.startsWith('southc')) {
			return new State('South Carolina', 'SC');
		}
		if(inState == 'sd' || inState == 'southdakota' || inState.startsWith('southd')) {
			return new State('South Dakota', 'SD');
		}
		if(inState == 'tn' || inState == 'tennessee' || inState.startsWith('ten')) {
			return new State('Tennessee', 'TN');
		}
		if(inState == 'tx' || inState == 'texas' || inState.startsWith('tex')) {
			return new State('Texas', 'TX');
		}
		if(inState == 'ut' || inState == 'utah' || inState.startsWith('uta')) {
			return new State('Utah', 'UT');
		}
		if(inState == 'vt' || inState == 'vermont' || inState.startsWith('ver')) {
			return new State('Vermont', 'VT');
		}
		if(inState == 'vi' || inState == 'virginislands' || inState.startsWith('virginis')) {
			return new State('Virgin Islands', 'VI');
		}
		if(inState == 'va' || inState == 'virginia' || inState.startsWith('virginia')) {
			return new State('Virginia', 'VA');
		}
		if(inState == 'wa' || inState == 'washington' || inState.startsWith('was')) {
			return new State('Washington', 'WA');
		}
		if(inState == 'wv' || inState == 'westvirginia' || inState.startsWith('wes')) {
			return new State('West Virginia', 'WV');
		}
		if(inState == 'wi' || inState == 'wisconsin' || inState.startsWith('wis')) {
			return new State('Wisconsin', 'WI');
		}
		if(inState == 'wy' || inState == 'wyoming' || inState.startsWith('wyo')) {
			return new State('Wyoming', 'WY');
		}
		    	
    	return null;
	}
	
	public class State {
		
		public String stateName;
		public String stateCode;
		
		public State(String stateName, String stateCode) {
			this.statename = stateName;
			this.statecode = stateCode;
		}			
	}
	
}